@extends('admin.layouts.admin')
@section('header') <link rel="stylesheet" href="{{ asset('admin/style/admin.css') }}" media="all"> @endsection
@section('content')
    <div class="layui-fluid">
        <div class="layui-card">
            <div class="layui-form layui-card-header layuiadmin-card-header-auto">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <div class="layui-input-inline lay-search">
                            <input type="text" name="keyword" placeholder="名称" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <div class="layui-input-inline lay-search">
                            <select name="category" id="category"  lay-search="">
                                <option value="">全部栏目</option>
                                <option value="独家研报">独家研报</option>
                                <option value="游资锦囊">游资锦囊</option>
                                <option value="股帮研究院">股帮研究院</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <div class="layui-input-inline lay-search">
                            <select name="isOpen" id="isOpen"  lay-search="">
                                <option value="">是否收费</option>
                                <option value="2">普通</option>
                                <option value="1">VIP</option>
                            </select>
                        </div>
                    </div>

                    <div class="layui-inline">
                        @include('admin.layouts._layout.form_search')
                    </div>
                </div>
            </div>

            <div class="layui-card-body">
                <div style="padding-bottom: 10px;">
                </div>

                <table id="LAY-form" lay-filter="LAY-form"></table>

                <script type="text/html" id="tpl_isOpen">
                    @{{# if(d.isOpen == 0){ }}
                    <span class="layui-badge layui-bg-orange">Vip</span>

                    @{{#  } else { }}
                    <span class="layui-badge layui-bg-green">open</span>
                    @{{#  } }}
                </script>

                <script type="text/html" id="table-controller">
                    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>
                </script>
            </div>
        </div>
    </div>
    <form id="destroy_form" method="post">{{ csrf_field() }} {{ method_field('DELETE') }}</form>
@endsection
@section('scripts')
    <script>
        layui.config({
            base: '../' //静态资源所在路径
        }).use([ 'table', 'form'], function(){
            var $ = layui.$
                ,form = layui.form
                ,table = layui.table
                ,views = layui.view;
            //

            /**
             * 表格列表
             */
            var cols = [[
                // {type: "checkbox", fixed: "left"},
                {type:  "numbers", title: "ID"}
                ,{field: "id", title: "文章ID", width: 100}
                ,{field: "subjectId", title: "研报社ID", width: 100}
                ,{field: "isOpen", title: "是否开放", templet:"#tpl_isOpen", width: 100}
                ,{field: "zlName", title: "栏目ID", width: 150}
                ,{field: "title", title: "名称"}
                ,{field: "created_at", title: "创建时间", sort : !0, width: 170}
                // ,{title: '操作', width: 200, align: 'center', fixed: 'right', toolbar: '#table-controller'}
                ]];
            var initTable = Common.initTable(cols);

            /**
             * 监听搜索
             */
            form.on('submit(LAY-search)', function(data){
                Common.search(data,1);
            });

        });//use

    </script>
@stop
